import QtQuick 1.0
import com.nokia.symbian 1.0
import "../js/Storage.js" as Storage

PurePage {
    id: sponsorPage

    anchors { fill: parent; topMargin: statusBar.height; bottomMargin: toolBar.height }

    ListModel {
        id: sponsorModel

        ListElement {
            level: "Diamond"
        }

        ListElement {
            level: "Gold"
        }

        ListElement {
            level: "Silver"
        }

        ListElement {
            level: "Bronze"
        }
    }

    LodingIndicator {
        id: lodingSponsorPage
    }

    Component {
        id: sponsorDelegate

       Column {

           FontLoader {
               id: fontStyle
               name: "Courier"
           }

           Rectangle {
               id: sponsorRect

               width:  sponsorPage.width
               height: 50
               color:  "#ffffff"
               border.width: 1
               border.color: "black"
               smooth: true

               Text {
                   id: sponsorLevel

                   anchors.verticalCenter: parent.verticalCenter

                   text: level
                   color: "black"
                   font.family: fontStyle.name
                   font.pixelSize: 20

                   wrapMode: Text.WordWrap

               }

               MouseArea {
                   id: sponsorMouse
                   anchors.fill: parent

                   onClicked: {
                       sponsorOpen.downloadSponsor(sponsorLevel.text.toLowerCase());
                       pageStack.push(sponsorOpen);
                   }

                   onPressed: {
                       parent.color = "#f2f2f2"
                   }

                   onReleased: {
                       parent.color = "#ffffff"
                   }

                   onCanceled: {
                       parent.color = "#ffffff"
                   }
               }
           }
    }
    }


    ListView {
        id: sponsorListView

        anchors { fill: parent}
        cacheBuffer: 2 * height
        delegate: sponsorDelegate
        model: sponsorModel
    }

    ScrollBar {
        flickableItem: sponsorListView
        anchors { right: sponsorListView.right; top: sponsorListView.top }
    }
}
